1 00:00:00,420 --> 00:00:04,780 Now I'm going to add scripts to my mind and I'm going to start with the LED. 2 00:00:04,800 --> 00:00:06,220 I'm going to make the blank script. 3 00:00:06,240 --> 00:00:08,970 So let's go to our landmine led. 4 00:00:09,000 --> 00:00:15,120 Hit the plus, add a script, and we'll just change that to blank. 5 00:00:16,470 --> 00:00:17,820 I'll get rid of that print statement. 6 00:00:17,820 --> 00:00:24,780 I'm not going to need it, but I do need a variable local led script dot parent. 7 00:00:24,810 --> 00:00:30,000 So this is going to get me a variable to my led to the part that the script is attached to. 8 00:00:30,480 --> 00:00:31,620 I'll say local. 9 00:00:31,620 --> 00:00:36,330 I need a random number generator so that all the blinks aren't exactly the same because that would look 10 00:00:36,330 --> 00:00:36,930 weird. 11 00:00:37,170 --> 00:00:44,850 I'm going to call that R&D and then we'll use this random class random dot new to get an instance of 12 00:00:44,850 --> 00:00:48,690 random number generator not using a seed value. 13 00:00:48,690 --> 00:00:51,810 If you guys know what that means, you're more than welcome to use it. 14 00:00:51,900 --> 00:00:53,670 Overkill for a blank script. 15 00:00:54,030 --> 00:00:55,680 All right, now I need two variables. 16 00:00:55,680 --> 00:00:56,730 One, for how long? 17 00:00:56,760 --> 00:00:57,930 The light's going to be on. 18 00:00:57,930 --> 00:00:59,220 One for how long? 19 00:00:59,220 --> 00:01:00,450 The light's going to be off. 20 00:01:01,170 --> 00:01:01,540 I'll say. 21 00:01:01,560 --> 00:01:04,260 Local on pause. 22 00:01:04,860 --> 00:01:07,650 It's paused on how long it's going to be on. 23 00:01:08,220 --> 00:01:12,210 We'll do R&D from our random number generator colon. 24 00:01:12,270 --> 00:01:17,790 I'm going to hit next number, not next integer, because I want a decimal number somewhere between 25 00:01:17,790 --> 00:01:19,560 a half a second and a second. 26 00:01:19,710 --> 00:01:26,220 So next number, point 5 to 1 second. 27 00:01:26,950 --> 00:01:27,140 Right? 28 00:01:27,450 --> 00:01:31,620 And then the off pause is going to be how long the light is off. 29 00:01:31,620 --> 00:01:34,410 So I'll use a random number generator. 30 00:01:35,820 --> 00:01:40,500 Next number, I'll go from one second to 1.5 seconds. 31 00:01:40,500 --> 00:01:43,230 So it's going to be off a little longer than on that. 32 00:01:43,260 --> 00:01:44,040 I'll do a while. 33 00:01:44,040 --> 00:01:44,610 True. 34 00:01:44,610 --> 00:01:46,230 Do loop. 35 00:01:46,230 --> 00:01:49,770 So this will loop as long as the mine is in the game. 36 00:01:49,770 --> 00:01:53,220 But when it gets blown up, it's going to be it's going to be cleaned up. 37 00:01:53,220 --> 00:01:54,420 So this will stop. 38 00:01:54,990 --> 00:01:59,700 We're going to start out with the LED material as the default material. 39 00:01:59,700 --> 00:02:07,470 Every time we start a new iteration of the loop, we'll use our enum material Neon. 40 00:02:07,470 --> 00:02:08,940 That's what we started with. 41 00:02:09,360 --> 00:02:16,980 The LED brick color will be brick color, new, really red. 42 00:02:18,390 --> 00:02:18,780 All right. 43 00:02:18,780 --> 00:02:23,730 So I had to use the new operator to get that really red because the default colors just aren't that 44 00:02:23,730 --> 00:02:24,570 specific. 45 00:02:25,230 --> 00:02:28,230 And then I'll wait and we'll go on pause. 46 00:02:28,230 --> 00:02:29,850 That's how long it's going to stay on. 47 00:02:29,850 --> 00:02:32,130 And now we're going to go, oh, we're going to turn it off. 48 00:02:32,130 --> 00:02:43,500 So led material, let's make it something bland like plastic E material, dot plastic, and we'll change 49 00:02:43,500 --> 00:02:44,280 the color. 50 00:02:44,310 --> 00:02:48,060 Let's go LED brick color. 51 00:02:48,990 --> 00:02:53,220 And I can use the default brick color dot black. 52 00:02:53,220 --> 00:02:53,460 Right? 53 00:02:53,490 --> 00:02:55,230 I don't have to get fancy with that one. 54 00:02:56,340 --> 00:02:58,230 And then we'll do wait off. 55 00:02:58,230 --> 00:02:59,070 Pause. 56 00:03:00,720 --> 00:03:01,830 All right, let's see what we got. 57 00:03:01,830 --> 00:03:04,710 Let's play our game, see if we've got some blinking going on. 58 00:03:10,140 --> 00:03:11,040 There we go. 59 00:03:11,700 --> 00:03:12,510 I like it. 60 00:03:13,340 --> 00:03:20,270 Probably not what you would do in a real military situation, but it's it's kind of cool for the game. 61 00:03:20,270 --> 00:03:24,890 So let's go ahead and in the next video, we will make it blow up.